<%@page import="debugs.NewsDebug"%>
<%@page import="helpers.ImageHelper"%>
<%@page import="models.UserModel"%>
<%@page import="java.util.Map"%>
<%@page import="java.net.URLEncoder"%>
<%@page import="helpers.DateHelper"%>
<%@page import="models.NewsModel"%>
<%@page import="java.util.ArrayList"%>
<%@page import="helpers.UrlHelper"%>
<%@page import="models.SiteConfigModel"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
SiteConfigModel siteConfig = (SiteConfigModel) request.getAttribute("config");
String image = "";//UrlHelper.getServerUrl(request) + "/blobstore-serve?blob-key=" + siteConfig.getLogo();
String name = (String) request.getAttribute("name");
ArrayList<NewsModel> list_news = (ArrayList<NewsModel>) request.getAttribute("list_news");
ArrayList<NewsModel> hot_news = (ArrayList<NewsModel>) request.getAttribute("hot_news");
Map<String, UserModel> users = (Map<String, UserModel>) request.getAttribute("users");
%>

<jsp:include page="/layouts/header.jsp">
    <jsp:param name="title" value="<%=siteConfig.getTitle()%>" />
    <jsp:param name="description" value="<%=siteConfig.getMetaDescription()%>" />
    <jsp:param name="keywords" value="<%=siteConfig.getMetaKeywords()%>" />
    <jsp:param name="ogsite_name" value="<%=siteConfig.getSiteName()%>" />
    <jsp:param name="ogtitle" value="<%=siteConfig.getTitle()%>" />
    <jsp:param name="ogurl" value="<%=UrlHelper.getServerUrl(request)%>" />
    <jsp:param name="ogimage" value="<%=image %>" />
    <jsp:param name="ogdescription" value="<%=siteConfig.getMetaDescription()%>" />
</jsp:include>
<script type="text/javascript" src="/js/home.js"></script>
			<div class="block-content">
				<!-- LIST NEWS -->
				<div class="column-block">
					<div class="block-column-2">
						<div class="inner-block">
							<h2 class="title-block">Lastest links</h2>
							<h3 class="title-block-blur">The newest links</h3>
						</div>
						<!-- list-news -->
						<ul class="list-news">
							<% for (int i = 0; i < list_news.size(); i++) { %>
							<li>
								<div class="news-item">
									<div class="thumb right">
										<a href="/view/<%=list_news.get(i).getId() %>/<%=list_news.get(i).getAlias() %>" alt="" width="60" height="60"><img width="60" height="60" src="<%=ImageHelper.getSrcFirstImage(list_news.get(i).getDescription()) %>"></a>
									</div>
									<div class="inner-news-item">
										<h2>
											<a target="_blank" href="/goto?url=<%=URLEncoder.encode(list_news.get(i).getUrl())%>"><%=list_news.get(i).getTitle() %></a>
											<span class="desc"><%//=list_news.get(i).getDescription()%></span>
										</h2>
										<div class="info">
											<span class="user-info"> 
												<a title="#" href="#"><img width="15" height="15" src="/images/user-icon.png"><strong><%=users.get(list_news.get(i).getCreator()) != null ? users.get(list_news.get(i).getCreator()).getName() : ""   %></strong></a> submit
											</span>
											<span class="separator">-</span>
											<span class="Category">
												<a title="" href="#"><%=list_news.get(i).getCategory() %></a>
											</span>
											<span class="separator">-</span>
											<span class="source"><a href="http://<%=UrlHelper.fomatDomains(list_news.get(i).getUrl()) %>" target="_blank" class="link"><%=UrlHelper.fomatDomains(list_news.get(i).getUrl()) %></a></span>
										</div>
										<div class="info">
											<a href="#" class="timeago" title="<%=DateHelper.getStringFromDate(list_news.get(i).getCreated(), "yyyy-MM-dd HH:mm:ss")%>"></a>
											<!-- 
											<a href="#" title="" class="comment-count">5 bÃ¬nh luáº­n</a>
											 -->
										</div>
									</div>
								</div>
							</li>
							<% } %>
						</ul>
						<!-- end list-news -->
						
						<div id="news-action">
							<div class="view-more clearfix">
								<a title="" href="#" class="more">View more</a>
								<span class="ml10" id="ajax-getmore-loading" style="display: none;">
									<img src="/images/ajax-loader.gif" alt="Loading...">
								</span>
							</div>
						</div>
						
					</div>
					<div class="block-column-1">
						<div class="sidebar-block">
							<h2 class="title-block">Hot links</h2>
							<ul class="list-hot-news">
								<% for (int i = 0; i < hot_news.size(); i++) { %>
								<li>
									<div class="link-item">
										<div class="thumb"><a href="/view/<%=list_news.get(i).getId() %>/<%=list_news.get(i).getAlias() %>"><img width="30" height="30" src="<%=ImageHelper.getSrcFirstImage(hot_news.get(i).getDescription()) %>"></a></div>
										<div class="title"><a href="/goto?url=<%=URLEncoder.encode(hot_news.get(i).getUrl())%>"><%=hot_news.get(i).getTitle() %></a></div>
										<div class="clear"></div>
									</div>
								</li>
								<% } %>
							</ul>
						</div>
					</div>
					<div class="clear"></div>
				</div>
				<!-- END LIST NEWS -->
			</div>

<jsp:include page="/layouts/footer.jsp">
    <jsp:param name="language" value="1" />
</jsp:include>	